/*
 * test.java
 *
 * Created on 29 maart 2008, 11:29
 */
package client.gui;

import client.communication.*;
import client.communication.ClientCommunication;
import client.gui.BoggleClient;
import client.gui.Galgje;
import client.gui.ScrabbleClient;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import org.apache.log4j.Logger;
import data.Gameroom;
import data.Gameroom.Gametype;
import data.Gebruiker;

/**
 *
 * @author  Liesbeth
 */
public class CreateGameroom extends javax.swing.JDialog {

    private Gebruiker gebruiker;
    private Logger logger = Logger.getLogger(CreateGameroom.class);
    private JButton knop;
    private Gameroom gameroom = null;

    /** Creates new form CreateGameroom */
    public CreateGameroom(Gebruiker g, JFrame parent) {
        super(parent, "Start een nieuw spelletje", true);
        initComponents();
        ClientCommunication.getInstance().setFrmCreateGameroom(this);
        this.gebruiker = g;
        //this.setVisible(true);
        cboSpelType.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Scrabble", "Boggle"}));
        cboSpelType1.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Galgje"}));
        pack();
        txtNaam.requestFocus();
    }

    public boolean toon() {
        knop = null;
        setVisible(true);
        return knop == btnOk;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Multiplayertab = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        chkPrive = new javax.swing.JCheckBox();
        cboSpelType = new javax.swing.JComboBox();
        btnAnnuleren = new javax.swing.JButton();
        txtNaam = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        txtPassword = new javax.swing.JPasswordField();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        btnOk = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        ddlMaxAantalSpelers = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        cboMin = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        cboSec = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        ddlMaxAantalKeerGepast = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        ddlMaxAantalBeurtVerlopen = new javax.swing.JComboBox();
        jLabel12 = new javax.swing.JLabel();
        helpLinkLabel1 = new client.gui.controls.HelpLinkLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        cboSpelType1 = new javax.swing.JComboBox();
        btnAnuleren = new javax.swing.JButton();
        btnSingleplayerOk = new javax.swing.JButton();
        helpLinkLabel2 = new client.gui.controls.HelpLinkLabel();

        chkPrive.setText("Prive");
        chkPrive.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                chkPriveStateChanged(evt);
            }
        });
        chkPrive.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                chkPriveItemStateChanged(evt);
            }
        });

        btnAnnuleren.setText("Annuleren");
        btnAnnuleren.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAnnulerenActionPerformed(evt);
            }
        });

        jLabel2.setText("Type: ");

        txtPassword.setEditable(false);

        jLabel1.setText("Naam: ");

        jLabel3.setText("Paswoord:");

        btnOk.setText("OK");
        btnOk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOkActionPerformed(evt);
            }
        });

        jLabel5.setText("Max aantal spelers:");

        ddlMaxAantalSpelers.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4" }));
        ddlMaxAantalSpelers.setSelectedIndex(1);

        jLabel6.setText("Max tijd per beurt: ");

        cboMin.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5" }));
        cboMin.setSelectedIndex(1);

        jLabel7.setText("min");

        cboSec.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "10", "20", "30", "40", "50" }));
        cboSec.setSelectedIndex(1);

        jLabel8.setText("sec");

        jLabel9.setText("Spel stopt nadat alle spelers:");

        ddlMaxAantalKeerGepast.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3" }));

        jLabel10.setText("keer hebben gepast");

        jLabel11.setText("Speler wordt verwijderd uit spel na: ");

        ddlMaxAantalBeurtVerlopen.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2", "3", "4", "5" }));
        ddlMaxAantalBeurtVerlopen.setSelectedIndex(1);

        jLabel12.setText("keer beurt te laten verlopen");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel2))
                        .addGap(4, 4, 4)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtNaam, javax.swing.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE)
                            .addComponent(cboSpelType, 0, 316, Short.MAX_VALUE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(helpLinkLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(94, 94, 94)
                        .addComponent(btnOk)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAnnuleren, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(ddlMaxAantalSpelers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(48, 48, 48)
                        .addComponent(chkPrive)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3)
                        .addGap(28, 28, 28)
                        .addComponent(txtPassword, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE)))
                .addContainerGap())
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cboMin, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cboSec, 0, 132, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel8)
                .addGap(29, 29, 29))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ddlMaxAantalKeerGepast, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel10)
                .addContainerGap(78, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ddlMaxAantalBeurtVerlopen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel12)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtNaam, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(cboSpelType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(ddlMaxAantalSpelers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(cboMin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(cboSec, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(ddlMaxAantalKeerGepast, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(ddlMaxAantalBeurtVerlopen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(chkPrive)
                            .addComponent(jLabel3)
                            .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnAnnuleren)
                            .addComponent(btnOk)))
                    .addComponent(helpLinkLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        Multiplayertab.addTab("Multiplayer games", jPanel1);

        jLabel4.setText("Type: ");

        btnAnuleren.setText("Annuleren");
        btnAnuleren.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAnulerenActionPerformed(evt);
            }
        });

        btnSingleplayerOk.setText("Ok");
        btnSingleplayerOk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSingleplayerOkActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cboSpelType1, 0, 313, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addComponent(helpLinkLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 177, Short.MAX_VALUE)
                        .addComponent(btnSingleplayerOk, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAnuleren, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(cboSpelType1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 188, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(btnAnuleren)
                        .addComponent(btnSingleplayerOk))
                    .addComponent(helpLinkLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        Multiplayertab.addTab("Singleplayer games", jPanel2);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Multiplayertab)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Multiplayertab, javax.swing.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE)
                .addContainerGap())
        );

        Multiplayertab.getAccessibleContext().setAccessibleName("Multiplayertab");
    }// </editor-fold>//GEN-END:initComponents
    private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
        // TODO add your handling code here:
        if (chkPrive.isSelected() && (txtPassword.getPassword().length == 0 || new String(txtPassword.getPassword()).equals("null"))) {
            JOptionPane.showMessageDialog(this, "Gelieve een geldig paswoord te kiezen!");
        } else if (txtNaam.getText().trim().isEmpty()) {
            JOptionPane.showMessageDialog(this, "Geef een naam op voor je gameroom!");
        } else {
            Gameroom gr = new Gameroom();
            gr.setGamenaam(txtNaam.getText());
            if (cboSpelType.getSelectedItem().toString().equalsIgnoreCase(Gametype.SCRABBLE.toString())) {
                gr.setType(Gametype.SCRABBLE);
            }else if (cboSpelType.getSelectedItem().toString().equalsIgnoreCase(Gametype.BOGGLE.toString())){
                gr.setType(Gametype.BOGGLE);
            }  
            gr.addSpelers(gebruiker);

            //wanneer password leeg, geen password beveilgde kamer
            gr.setPaswoord(new String(txtPassword.getPassword()));
            gr.setTijdPerBeurtInSeconden(Integer.parseInt((String)cboMin.getSelectedItem())*60 + Integer.parseInt((String)cboSec.getSelectedItem()));
            
            gr.setMaxAantalSpelers(Integer.parseInt(ddlMaxAantalSpelers.getSelectedItem().toString()));
            gr.setMaxAantalKeerGepast(Integer.parseInt(ddlMaxAantalKeerGepast.getSelectedItem().toString()));
            gr.setMaxAantalKeerBeurtVerlopen(Integer.parseInt(ddlMaxAantalBeurtVerlopen.getSelectedItem().toString()));
            gr.setNicknameOprichter(gebruiker.getNickname());
            this.gameroom = gr;
            ClientCommunication.getInstance().createGameroom(gr);
        }
}//GEN-LAST:event_btnOkActionPerformed
    //de communicatieklasse zal deze methode oproepen
    //wanneer er een gameroom aangeùmaakt is zal deze toegevoegd worden aan de list met gamerooms
    //zoniet bestaat de naam van deze gameroom al en zal de gebruiken en nieuwe kamer moeten aanmaken
    public void gameroomAangemaakt(boolean aangemaakt,Gametype type) {
        if (!aangemaakt) {
            this.gameroom = null;
            JOptionPane.showMessageDialog(this, "Er bestaat al een gameroom met deze naam \n Gelieve een andere unieke naam te kiezen");
        } else {
            this.dispose();
            
            //Scrabble client starten
            
            if(type.equals(Gametype.SCRABBLE)){
                ScrabbleClient sc = new ScrabbleClient(this.gebruiker, ClientCommunication.getInstance().getChatroom(), this.gameroom);
                ClientCommunication.getInstance().getChatroom().setScrabbleGame(sc);
                //sc.vraagBlokjesAan(ClientCommunication.getInstance().getPlankje().getMaxAantalBlokjes(), gebruiker.getNickname(), gameroom.getGamenaam());
                ClientCommunication.getInstance().getChatroom().setVisible(false);
                sc.toon();

                //sc.enableKnoppen(aangemaakt);
            }else if(type.equals(Gametype.BOGGLE)){
                BoggleClient bc = new BoggleClient(this.gebruiker, ClientCommunication.getInstance().getChatroom(), this.gameroom,true);
                ClientCommunication.getInstance().getChatroom().setBoggleGame(bc);
                ClientCommunication.getInstance().getChatroom().setVisible(false);
                bc.pack();
                bc.toon();
            }
        }
    }

    private void btnAnnulerenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAnnulerenActionPerformed
        // TODO add your handling code here:
        this.dispose();
}//GEN-LAST:event_btnAnnulerenActionPerformed

    private void chkPriveItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_chkPriveItemStateChanged
        // TODO add your handling code here:
        txtPassword.setEditable(evt.getStateChange() == ItemEvent.SELECTED);
}//GEN-LAST:event_chkPriveItemStateChanged

    private void chkPriveStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_chkPriveStateChanged
        // TODO add your handling code here:
        if (!chkPrive.isSelected()) {
            txtPassword.setText("");
        }
    }//GEN-LAST:event_chkPriveStateChanged

    private void btnAnulerenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAnulerenActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_btnAnulerenActionPerformed

    private void btnSingleplayerOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSingleplayerOkActionPerformed
        // TODO add your handling code here:
        
        if(cboSpelType1.getSelectedItem().toString().equalsIgnoreCase(Gametype.GALGJE.toString())){
            this.dispose();
            ClientCommunication.getInstance().getChatroom().getPnlTabs().setSelectedIndex(0);
            JFrame venster = new JFrame("Galgje");
            venster.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            venster.add(new Galgje(venster));
            venster.setPreferredSize(new Dimension(800,800));
            venster.pack();
            venster.setVisible(true);
            venster.toFront();
        }
    }//GEN-LAST:event_btnSingleplayerOkActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane Multiplayertab;
    private javax.swing.JButton btnAnnuleren;
    private javax.swing.JButton btnAnuleren;
    private javax.swing.JButton btnOk;
    private javax.swing.JButton btnSingleplayerOk;
    private javax.swing.JComboBox cboMin;
    private javax.swing.JComboBox cboSec;
    private javax.swing.JComboBox cboSpelType;
    private javax.swing.JComboBox cboSpelType1;
    private javax.swing.JCheckBox chkPrive;
    private javax.swing.JComboBox ddlMaxAantalBeurtVerlopen;
    private javax.swing.JComboBox ddlMaxAantalKeerGepast;
    private javax.swing.JComboBox ddlMaxAantalSpelers;
    private client.gui.controls.HelpLinkLabel helpLinkLabel1;
    private client.gui.controls.HelpLinkLabel helpLinkLabel2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JTextField txtNaam;
    private javax.swing.JPasswordField txtPassword;
    // End of variables declaration//GEN-END:variables
}
